/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import Records.RecordsMain;
import java.util.ArrayList;
import javax.swing.JTable;

/**
 *
 * @author Alexander Wilson
 */
public class TableAttributeAdjust {

    private static ArrayList songAttributes;

    public static ArrayList AdjustAttributes(String song, String songView, JTable tableName, int rowNumber) {
                System.out.println("SaveImage.NewDir(" + song+ ", " + songView + ", " + tableName.toString() + ", " + rowNumber + ")");

        songAttributes = new ArrayList();
        if (!tableName.equals(RecordsMain.getUI().userLibrary)) {
            if (!song.equals(songView)) {
                for (int columnNumber = 0; columnNumber < 7; columnNumber++) {
                    songAttributes.add(retrieveTableAttribute(tableName, rowNumber, columnNumber));
                }
            } else {
                for (int columnNumber = 0; columnNumber < 7; columnNumber++) {
                    songAttributes.add(retrieveModelAttribute(tableName, rowNumber, columnNumber));
                }
            }
        } else {
            if (!song.equals(songView)) {
                for (int columnNumber = 0; columnNumber < 9; columnNumber++) {
                    songAttributes.add(retrieveTableAttribute(tableName, rowNumber, columnNumber));
                }
            } else {
                for (int columnNumber = 0; columnNumber < 9; columnNumber++) {
                    songAttributes.add(retrieveModelAttribute(tableName, rowNumber, columnNumber));
                }
            }
        }
        return songAttributes;
    }

    public static String retrieveTableAttribute(JTable tableName, int rowNumber, int columnNumber) {
        return tableName.getValueAt(rowNumber, columnNumber).toString();
    }

    public static String retrieveModelAttribute(JTable tableName, int rowNumber, int columnNumber) {
        return tableName.getModel().getValueAt(rowNumber, columnNumber).toString();
    }
}
